/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;
import dbconnector.DBDriver;
import java.sql.PreparedStatement;
import AO.Announcement;

/**
 *
 * @author FRIENDS
 */
public class AnnouncementDAO 
{
 
     public static boolean save(Announcement ann) throws Exception
     {
      try
      {
      PreparedStatement pstmt = DBDriver.getPrepare("insert into announcements values(?,?,?,?,?,?,?,?,null)");
      pstmt.setString(1, ann.getAnnounceid());
      pstmt.setString(2, ann.getAnnouncetype());
      pstmt.setString(3, ann.getCatagory());
      pstmt.setString(4, ann.getTousers());
      pstmt.setString(5, ann.getCourseid());
      pstmt.setString(6, ann.getAuthor());
      pstmt.setString(7, ann.getSubject());
      pstmt.setString(8, ann.getDescription());
      System.out.println("bean added not commited");
      int i=pstmt.executeUpdate();
      if(i==1)
      {  System.out.println("bean added");
          return true;
      }
    }catch(Exception e){e.printStackTrace();}
      return false;
     }
}
    
    
  